APManage &
UpStainfo &
sleep 20
i=0
j=0
while [ 1 ]
do
	DHCP_num=`ps | grep "dhcpcd br-lan" | grep -v "grep " | wc -l`
	if [ $DHCP_num == "0" ];  then
		killall APManage
		killall UpStainfo
		killall dhcpcd
		sleep 2
		dhcpcd br-lan
	fi

	sleep 1
	APManage_num=`ps | grep "APManage" | grep -v "grep " | wc -l`
	if [ $APManage_num == "0" ];  then
		APManage &
	fi
	if [ $i == "3" ];  then
		killall APManage
		sleep 2
		APManage &
	fi
	sleep 1
	UpStainfo_num=`ps | grep "UpStainfo" | grep -v "grep " | wc -l`
	if [ $UpStainfo_num == "0" ];  then
		UpStainfo &
	fi
	if [ $j == "3" ];  then
		killall UpStainfo
		sleep 2
		UpStainfo &
	fi
	if [ -f "/tmp/WTP_quit" ]; then
		rm /tmp/WTP_quit
		i=0
	else
		i=$(($i+1))
	fi
	if [ -f "/tmp/quit_WTP" ]; then
		rm /tmp/quit_WTP
		j=0
	else
		j=$(($j+1))
	fi
	sleep 40
done
